#include "shellCmd.h"

static void printosdInfo()
{
	printf("call printosdInfo\n");
}

static bool osd_match(char *cmd)
{
	if(matchCmd(cmd, "osd"))
	{
		return TRUE;
	}
	else
		return FALSE;
}
static void osd_help()
{
	printf("osd: \n"
			"\t info\tlist device osd params(format, rect)\n"
			"\t window\tosd operate\n"
			"\t\t\t id\tcurrent window handle\n"
			"\t\t\t ids\tlist window all handle\n"
			"\t\t\t jump[id]\topen some window\n"
			);
}
static void osd_window_help()
{
 	printf("osd window:\tosd operate\n"
			"\t\t id\tcurrent window handle\n"
			"\t\t ids\tlist window all handle\n"
			"\t\t jump [id]\topen some window\n"
			);	
}
static void printCurrentWindowId()
{
	printf("call printCurrentWindowId\n");
}
static void listWindowIds()
{
	printf("call listWindowIds\n");
}
static void jumpWindowById()
{
	printf("call jumpWindowById\n");
}
static void osd_window_run(int argc, char **argv)
{
	if(argc<=1)
	{
		osd_window_help();
		return ;
	}
	if(strcmp(argv[1], "id") == 0)
	{
		printCurrentWindowId();
	} else if(strcmp(argv[1], "ids") == 0)
	{
		listWindowIds();
	} else if(strcmp(argv[1], "jump") == 0)
	{
		if(argc>=3)
			jumpWindowById(atoi(argv[2]));
		else
			jumpWindowById(0);
	}else
		osd_window_help();
}
static void osd_run(int argc, char **argv)
{
	if(argc<=1)
	{
		osd_help();
		return;
	}
	if(matchCmd(argv[1], "info"))
	{
		printosdInfo();
	}else if(matchCmd(argv[1], "window"))
	{
		osd_window_run(argc-1, &argv[1]);
	}else
	{
		osd_help();
	}
}

SHELL_CMD s_osd = {
	.run = osd_run,
	.match = osd_match,
	.help = osd_help,
};

